﻿// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. 
// See License.txt in the project root for license information.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Diagnostics.Contracts;
using System.Threading.Tasks;

namespace System.Cloud.Collections
{
    // An IAsyncList is an asynchronous version of an IList<T>.
    // It returns an IObservable<T> instead of an IEnumerable<T>, perhaps with snapshot semantics, perhaps not.
    // @TODO: Resolve that.
    public interface IListAsync<T> : ICollectionAsync<T>
    {
        Task<T> GetItemAsync(int index);
        Task SetItemAsync(int index, T value);
        Task<int> IndexOfAsync(T item);
        Task InsertAsync(int index, T item);
        Task RemoveAtAsync(int index);

        // Less chatty versions
        Task AddAsync(IEnumerable<T> items);
        Task AddOnceAsync(IEnumerable<T> items);
        Task RemoveRangeAsync(int index, int count);
    }
}
